//Loop from 1 to 100
//If number divisible by 3 then print fizz
//If number divisible by 5 then print buzz
//If number divisible by 3 and 5 then print fizz buzz

//if number 

function fizzbuzzLoop(){
    var i=1;
    for (i=1;i<=100;i++) {
	fizzbuzz(i);
    }
}

function fizzbuzz(i) {
		if (divisibleBy3And5(i)) {
			
			updateMessage("Number " + i + " divided by 3 and 5 so fizzbuzz");
			
		} else if(divisibleBy3(i)) {
			updateMessage("Number " + i + " divided by 3 so fizz");
			
		} else if(divisibleBy5(i)){

			updateMessage("Number " + i + " divided by 5 so buzz");

		}

}

//Defining functions

function divisibleBy3And5(i) {
	if (i%3==0 && i%5==0) {
	return true;	
	}
	return false;
}

function divisibleBy3(i){
	if (i%3==0) {
	return true;
	}
	return false;
}

function divisibleBy5(i) {
	if (i%5==0) {
	return true;
	}
	return false;
}


function updateMessage(msg) {
	$("#myP").text(msg);
}